package com.zzj.hotel.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.zzj.hotel.core.entity.User;
import com.zzj.hotel.dao.UserDao;
import com.zzj.hotel.service.UserService;

public class UserServiceImpl implements UserService {
	private UserDao userDao;

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public User findById(String id) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(User.ID, id);
		return userDao.selectOne(queryMap);
	}

	public List<User> findAll() {
		return userDao.selectList(null);
	}

	public User findOne(String username, String password) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		queryMap.put(User.USERNAME, username);
		queryMap.put(User.PASSWORD, password);
		return userDao.selectOne(queryMap);
	}
}
